package com.jie.boot.repository;

import java.util.List;

import org.springframework.data.repository.query.Param;

import spring.data.jpa.repository.CommonJpaRepository;
import spring.data.jpa.repository.support.template.TemplateParam;
import spring.data.jpa.repository.support.template.TemplateQuery;

import com.jie.boot.domain.Task;
import com.jie.boot.domain.User;

/**
 * @author wangjie
 */
public interface UserRepository extends CommonJpaRepository<User, Long> {

    User findByName(String name);

    @TemplateQuery
    List<User> findByParams(@Param("name") String name);

    @TemplateQuery
    List<User> findWithTask(@TemplateParam("user") User user, @TemplateParam("task") Task task);
}
